package jltx.fragmentpageframework.wetchat.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;

import cn.jltx.support.SupportFragment;
import cn.jltx.utils.ViewHelper;
import jltx.fragmentpageframework.R;

/**
 * @author jltxseo
 *         Created by junlintianxia on 2017/06/20.
 */

public class WetChatFindFragment extends SupportFragment{
    private static final String ARG_TABTITLE = "arg_tabtitle";
    private static final String ARG_TABPOS = "arg_tabpos";
    private String tabTitle;
    private int tabPos;

    private ProgressBar progressBar;
    private TextView textView;
    public WetChatFindFragment() {
    }

    public static WetChatFindFragment newInstance(String tabTitle, int tabPos){
        Bundle args = new Bundle();
        args.putString(ARG_TABTITLE,tabTitle);
        args.putInt(ARG_TABPOS,tabPos);

        WetChatFindFragment fragment = new WetChatFindFragment();
        fragment.setArguments(args);
        return fragment;

    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        Bundle args = getArguments();
        if(args != null){
            tabTitle = args.getString(ARG_TABTITLE);
            tabPos = args.getInt(ARG_TABPOS);
        }
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_wetchat_find,container,false);
        progressBar = ViewHelper.findViewById(rootView,R.id.load);
        textView = ViewHelper.findViewById(rootView,R.id.tv);
        return rootView;
    }

    @Override
    public void onLazyInitView(@Nullable Bundle savedInstanceState) {
        super.onLazyInitView(savedInstanceState);
        getView().postDelayed(new Runnable() {
            @Override
            public void run() {
                progressBar.setVisibility(View.GONE);
                textView.setVisibility(View.VISIBLE);
                textView.setText(textView.getText()+"懒加载完成");
            }
        },2000);

    }

}
